﻿using RuoVea.ExSugar.Attributes;
using RuoVea.ExSugar.Entity;
using SqlSugar;
using System.ComponentModel;

namespace RuoVea.OmiApi.Article.Entitys;

/// <summary>
/// 文章-标签中间表（多对多关系）
/// </summary>
[SugarTable(nameof(ArtArticleTag), TableDescription = "文章-标签中间表（多对多关系）")]
[Description("文章-标签中间表（多对多关系）")]
[SugarIndex($"IX_{nameof(ArtArticleTag)}_{nameof(ArticleId)}_{nameof(TagId)}", nameof(ArticleId), OrderByType.Asc, nameof(TagId), OrderByType.Asc, true)]
public class ArtArticleTag : AutoKeyBase
{
    /// <summary>
    /// 文章ID
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(ArticleId), columnDescription: "文章ID")]
    public long ArticleId { get; set; }

    /// <summary>
    /// 标签ID
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(TagId), columnDescription: "标签ID")]
    public long TagId { get; set; }

    /// <summary>
    /// 导航属性 - 文章
    /// </summary>
    [Navigate(NavigateType.OneToOne, nameof(ArticleId))]
    [SugarColumn(IsIgnore = true)]
    public ArtArticle Article { get; set; }

    /// <summary>
    /// 导航属性 - 标签
    /// </summary>
    [Navigate(NavigateType.OneToOne, nameof(TagId))]
    [SugarColumn(IsIgnore = true)]
    public ArtTag Tag { get; set; }
}
